package comman.duke 
{
	/**
	 * ...
	 * @author jerry.d
	 */
	public final class ResizableMgr 
	{
		private var _dirty:Boolean ;
		private var list:Vector.<IResizable>;
		public function ResizableMgr() 
		{
			this.list = new Vector.<IResizable>();
		}
		
		public function addResizable(panel:IResizable):void{
			if ( this.list.indexOf(panel) == -1){
				this.list.push(panel);
			}
		}
		
		public function check():void{
			if ( !this._dirty ) return;
			for each(var panel:IResizable in this.list){
				panel.onResize();
			}
			
			this._dirty = false;
		}
		
		public function valid():void{
			this._dirty = true;
		}
		
		private static var _instance:ResizableMgr;
		public static function get Instance():ResizableMgr{
			if ( ResizableMgr._instance == null ){
				ResizableMgr._instance = new ResizableMgr();
			}
			return ResizableMgr._instance;
		}
	}

}